home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Shareware
/
Utilitare
/
emu
/
Emu8086_Setup_307c.exe
/
{app}
/
Samples
/
bcd_aaa.asm
< prev
next >
Wrap
Assembly Source File
|
2002-11-28
|
713b
|
52 lines
; This example shows the use
; of AAA instruction (ASCII
; Adjust after Addition).
; It is used to add huge
; BCD numbers.
#make_COM#
ORG 100h
; first number '9':
MOV AH, 09h
; second number '5':
MOV AL, 05h
; AL = AL + AH =
; = 09h + 05h = 0Eh
ADD AL, AH
; clear tens byte of BCD
; result:
XOR AH, AH
; adjust result to BCD form,
; AH = 1, AL = 4 -> '14'
AAA
; print the result:
; store contents of
; AX register:
MOV DX, AX
; print first digit:
MOV AH, 0Eh
; convert to ascii:
OR DH, 30h
MOV AL, DH
INT 10h
; print second digit:
; convert to ascii:
OR DL, 30h
MOV AL, DL
INT 10h
RET
END